/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package be.ac.ua.pats.thesisrobotica.device.communication;

import java.io.IOException;
import java.io.StringWriter;

/**
 *
 * @author Admin
 */
public class CommandFactory {
    
    private Connection connection;
    private StringWriter s;


    public CommandFactory(Connection connection) {
        this.connection = connection;
    }


    public void setAndSend(Object[] objectArray) throws IOException {
        System.out.println("CommandFactory: SetAndSend(): Creating message");
        s = new StringWriter();
        for(Object o : objectArray) {
            s.append(String.valueOf(o));
            s.append(",");
        }
        System.out.println("CommandFactory: SetAndSend(): Sending message");
        connection.send(s.toString());
    }
}
